﻿<Window x:Class="JobBoardAdminPanel.Views.EditCompaniesWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="EditCompaniesWindow" Height="600" Width="900">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="0,5*"/>
            <RowDefinition Height="0,5*"/>
        </Grid.RowDefinitions>

        <DataGrid ItemsSource="{Binding Companies}" AutoGenerateColumns="False" IsReadOnly="True"
                  CanUserAddRows="False"
                  SelectedItem="{Binding CurrentCompany}">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding ID}"/>
                <DataGridTextColumn Header="Name"  Binding="{Binding Name}"/>
                <DataGridTemplateColumn Header="Image">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding Logo}" Height="100" Width="100"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Description" Binding="{Binding Description}"/>
                <DataGridTextColumn Header="WebSite" Binding="{Binding WebSite}"/>
                <DataGridTextColumn Header="Email" Binding="{Binding Email}"/>
                <DataGridTextColumn Header="Phone" Binding="{Binding Phone}"/>
            </DataGrid.Columns>

        </DataGrid>

        <Grid Grid.Row="1">
            <StackPanel Orientation="Horizontal" Margin="10">
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="EditItem" FontWeight="ExtraBold"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="ID: " Width="40"/>
                        <TextBlock Text="{Binding CurrentCompany.ID}"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Name:" Width="40"/>
                        <TextBox Width="150" Text="{Binding CurrentCompany.Name}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Logo:" Width="40"/>
                        <Button Content="Browse" Name="ButtonBrowse" Click="ButtonBrowse_Click"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Description:" Width="60"/>
                        <TextBox Width="150" Text="{Binding CurrentCompany.Description}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="WebSite:" Width="60"/>
                        <TextBox Width="150" Text="{Binding CurrentCompany.WebSite}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Email:" Width="40"/>
                        <TextBox Width="150" Text="{Binding CurrentCompany.Email}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Phone:" Width="40"/>
                        <TextBox Width="150" Text="{Binding CurrentCompany.Phone}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Button Name="ButtonSave" Content="Save" Command="{Binding SaveCommand}"/>
                        <Button Name="ButtonDelete" Content="Delete" Command="{Binding DeleteCommand}"/>
                    </StackPanel>
                
                </StackPanel>
                <StackPanel Margin="10">
                    <TextBlock Text="InsertItem" FontWeight="ExtraBold"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Name:" Width="40"/>
                        <TextBox Width="150" Text="{Binding NewCompany.Name}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Logo:" Width="40"/>
                        <Button Content="Browse" Name="ButtonNewBrowse" Click="ButtonBrowse_Click"/>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Description:" Width="60"/>
                        <TextBox Width="150" Text="{Binding NewCompany.Description}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="WebSite:" Width="60"/>
                        <TextBox Width="150" Text="{Binding NewCompany.WebSite}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Email:" Width="40"/>
                        <TextBox Width="150" Text="{Binding NewCompany.Email}" />
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Phone:" Width="40"/>
                        <TextBox Width="150" Text="{Binding NewCompany.Phone}" />
                    </StackPanel>
                    <Button Content="Add" Command="{Binding AddCommand}"/>
                </StackPanel>
            </StackPanel>


            <Button Name="BackToMain" Content="Back to main" FontWeight="bold" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="50" Width="150" Click="BackToMain_Click"/>
        </Grid>
    </Grid>
</Window>
